import { ref, onUnmounted  } from "vue"

export default function (props, emit) {
  const percent = ref(0) // 百分比
  if(props.type == 'time') {
    const timer = setInterval(() => {
      const descrase = (100 - percent.value) / 4 / Number(props.second)
      percent.value = _.range(percent.value + descrase, 0 ,99)
    }, 60)
    onUnmounted(() => {
      clearInterval(timer)
    })
  } else {

  }
  return {
    percent,
    emit,
  }
}